﻿import mx.events.EventDispatcher;


import com.mixmedia.mx.IEventDispatcher;
import com.mixmedia.mx.events.LoaderEvent;
import com.mixmedia.net.ILoadStrategy;
/**
 * @author colin
 */
class com.mixmedia.mx.MovieClipLoaderEvt extends MovieClipLoader implements IEventDispatcher, ILoadStrategy{
	private var target : Object;

	public function MovieClipLoaderEvt(){
		super();
		super.addListener(this);
		EventDispatcher.initialize(this);
	};

	public function loadClip(url:String, target:Object):Boolean{
		this.target = target;
		return super.loadClip(url,target);
	}

	public function getTarget() : Object {
		return target;
	}

	public function load(requestURL : String) : Void {
		loadClip(requestURL,this.target);
	}

	private function onLoadComplete(target_mc){
		dispatchEvent(new LoaderEvent(this,LoaderEvent.EVENTCOMPLETE,target_mc));
	}

	private function onLoadError(target_mc,errorCode){
		dispatchEvent(new LoaderEvent(this,LoaderEvent.EVENTERROR,target_mc,errorCode));
	}
	
	private function onLoadProgress(target_mc){
		dispatchEvent(new LoaderEvent(this,LoaderEvent.EVENTPROGRESS,target_mc));
	}

	private function onLoadInit(target_mc){
		dispatchEvent(new LoaderEvent(this,LoaderEvent.EVENTREADY,target_mc));
	}
	
	private function onLoadStart(target_mc){
		dispatchEvent(new LoaderEvent(this,LoaderEvent.EVENTOPEN,target_mc));
	}

	private function dispatchEvent(evt:LoaderEvent) {};
	public function addEventListener(event : String, handler) : Void {}
	public function removeEventListener(event : String, handler) : Void {}

}